from ..models.subjects_model import Subjects  # 根据你的实际模型路径调整
from sqlalchemy.orm import Session
from sqlalchemy import select


def get_all_subjects(db: Session):
    query = select(Subjects).order_by(Subjects.id.asc())
    subjects = db.execute(query).scalars().all()
    return [subject.as_dict() for subject in subjects]



# if __name__ == "__main__":
#     from database.db import SessionLocal
#
#     db = SessionLocal()
#     subjects = get_all_subjects(db)
#     print(subjects)